@model User
@{
    ViewData["Title"] = "Check Age";
}

<h2>Check Age ('Age' submitted via query string)</h2>
<form method="post" asp-action="CheckAge" asp-route-Age="99">
    <div class="form-horizontal">
        <h4>User Age</h4>
        <hr />
        <div asp-validation-summary="ModelOnly" class="text-danger"></div>
        <div class="form-group">
            <ol>
                <li>The 'Age' form value is provided as a query string value on this form.</code></li>
                <li>Because the <code>age</code> parameter is required from the query string with <code>[FromQuery]</code>, validation passes when submitting this form.</li>
            </ol>
        </div>
        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <input type="submit" value="Validate" class="btn btn-default" />
            </div>
        </div>
    </div>
</form>

<h2>Check Age ('Age' submitted via <code>&lt;body&gt;</code>)</h2>
<form method="post" asp-action="CheckAge">
    <input asp-for="Age" type="hidden" value="99" />
    <div class="form-horizontal">
        <h4>User Age</h4>
        <hr />
        <div asp-validation-summary="ModelOnly" class="text-danger"></div>
        <div class="form-group">
            <ol>
                <li>The 'Age' form value is set by a hidden <code>&lt;input&gt;</code> element on this form.</code></li>
                <li>When this form submits, the 'Age' value is sent to the app in the <code>&lt;body&gt;</code> of the form.</li>
                <li>Because the <code>age</code> parameter is required from the query string with <code>[FromQuery]</code>, validation fails when submitting this form.</li>
            </ol>
        </div>
        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <input type="submit" value="Validate" class="btn btn-default" />
            </div>
        </div>
    </div>
</form>

<div>
    <span style='font-size:2em;color:@ViewData["ValidationResultColorStyle"]''>@ViewData["ValidationResult"]</span>
</div>

@section Scripts {
    @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}

